#include"GameMonster.h"
#include<random>
#include<functional>
#include<iostream>

GameMonster::GameMonster()
{
}

GameMonster::GameMonster(const int& id, const Myvec& pos)
{
    m_id = id;
    m_isFight = false;
    m_isDie = false;
    setPos(pos);
}

GameMonster::~GameMonster()
{
}

double GameMonster::randomUnint(unsigned int min, unsigned int max, unsigned int seed)
{
    static std::default_random_engine e(seed);
    static std::uniform_real_distribution<double> u(min, max);
    return u(e);
}

bool GameMonster::addCanSee(const int& userId)
{
    auto iter = m_canSees.find(userId);
    if (iter != m_canSees.end())
    {
        return false;
    }
    m_canSees[userId] = 1;
    return true;
}

bool GameMonster::removeCanSee(const int& userId)
{
    auto iter = m_canSees.find(userId);
    if (iter != m_canSees.end())
    {
        m_canSees.erase(userId);
        return true;
    }
    return false;
}

void GameMonster::clearCanSee()
{
    m_canSees.clear();
}

int GameMonster::getId()
{
    return m_id;
}

int GameMonster::getTrackId()
{
    return m_trackId;
}

void GameMonster::setTrackId(const int& trackid)
{
    m_trackId = trackid;
}

void GameMonster::setFight(bool isFight)
{
    m_isFight = isFight;
}

bool GameMonster::isFight()
{
    return m_isFight;
}

bool GameMonster::isDie()
{
    return m_isDie;
}

void GameMonster::setDie(bool die)
{
    m_isDie = die;
}

const std::map<int, int>& GameMonster::getCanSees()
{
    return m_canSees;
}

void GameMonster::setRadius(float radius)
{
	m_radius = radius;
}
